const model = () => alert(111)

const double = (fn, delay = 3000) => {
  let timer = null
  if (timer) {
    clearTimeout(timer)
  }
  timer = setTimeout(() => {
    fn()
  }, delay)
}

const showError = () => double(model)

setTimeout(() => {
  showError()
}, 1000)

setTimeout(() => {
  showError()
}, 2000)
